% Load data for analysis

load('max_growthrate_arrays.mat');
load('activation_energies.mat');

%% First plot kcat (max growth rate) at 37 °C

T = [25 30 37]';
figure;

% Glucose
g = grmax_tot_glucose(1,:)';
ge = grmax_err_tot_glucose(1,:)';
errorbar(1./(T+273.15), log(g), ge./g, 'bo', 'linewidth', 1);
hold on;

[f1,f2] = fit(1./(T+273.15), log(g),'poly1');
plot(1./(T+273.15),f1(1./(T+273.15)), 'b', 'linewidth', 1);

% Acetate
g = grmax_tot_acetate(1,:)';
ge = grmax_err_tot_acetate(1,:)';
errorbar(1./(T+273.15), log(g), ge./g, 'ko', 'linewidth', 1);
hold on;

[f1,f2] = fit(1./(T+273.15), log(g),'poly1');
plot(1./(T+273.15),f1(1./(T+273.15)), 'k', 'linewidth', 1);

% Succinate
g = grmax_tot_succinate(1,:)';
ge = grmax_err_tot_succinate(1,:)';
errorbar(1./(T+273.15), log(g), ge./g, 'mo', 'linewidth', 1);
hold on;

[f1,f2] = fit(1./(T+273.15), log(g),'poly1');
plot(1./(T+273.15),f1(1./(T+273.15)), 'm', 'linewidth', 1);


% LB
g = grmax_tot_LB(1,:)';
ge = grmax_err_tot_LB(1,:)';
errorbar(1./(T+273.15), log(g), ge./g, 'ro', 'linewidth', 1);
hold on;

[f1,f2] = fit(1./(T+273.15), log(g),'poly1');
plot(1./(T+273.15),f1(1./(T+273.15)), 'r', 'linewidth', 1);

% NZCasePlus
g = grmax_tot_NZCasePlus(1,:)';
ge = grmax_err_tot_NZCasePlus(1,:)';
errorbar(1./(T+273.15), log(g), ge./g, 'go', 'linewidth', 1);
hold on;

[f1,f2] = fit(1./(T+273.15), log(g),'poly1');
plot(1./(T+273.15),f1(1./(T+273.15)), 'g', 'linewidth', 1);


set(gca, 'fontsize', 20);
set(gcf, 'Position', [0 0 400 300]);
xlabel('1/T (1/K)');
ylabel('Log (growth rate)');
xlim([1/312 1/296]);
